<?php
class PapiWS_Model_FaceVO
{
	public $id;
	public $name;
	public $boundingBox;
	public $maskWidth;
	public $maskHeight;
	public $eps;
	public $faceOrder;
	public $faceMask;
	public $faceMaskPreview;
	public $faceBackground;
	
	public function __construct( $data = null )
	{
		$drupal = Zend_Registry::get('config')->drupal->url;
		$this->id = $data['nid'];
		$this->name = $data['title'];
		$this->boundingBox = new PapiWS_Model_BoundingBoxVO();
		
		if( isset( $data['field_background'][0]['filepath'])) {
			$this->faceBackground = $drupal . $data['field_background'][0]['filepath'];
		}
		
		if( isset( $data['field_facemaskpreview'][0]['filepath'])) {
			$this->faceMaskPreview = $drupal . $data['field_facemaskpreview'][0]['filepath'];
		}

		if( isset( $data['field_facemask'][0]['filepath'])) {
			$this->faceMask = $drupal . $data['field_facemask'][0]['filepath'];
			list($this->maskWidth, $this->maskHeight ) = @getimagesize( $this->faceMask );
		}
		
		if( isset( $data['field_eps'][0]['filepath'])) {
			$this->eps = $drupal . $data['field_eps'][0]['filepath'];
		}

		if( isset( $data['field_faceorder'][0]['value'])) {
			$this->faceOrder = $data['field_faceorder'][0]['value'];
		}

		// bounding box
		if( isset( $data['field_width'][0]['value'])) {
			$this->boundingBox->width = $data['field_width'][0]['value'];
		}
		
		if( isset( $data['field_height'][0]['value'])) {
			$this->boundingBox->height = $data['field_height'][0]['value'];
		}
		
		if( isset( $data['field_top'][0]['value'])) {
			$this->boundingBox->top = $data['field_top'][0]['value'];
		}

		if( isset( $data['field_left'][0]['value'])) {
			$this->boundingBox->left = $data['field_left'][0]['value'];
		}


	}
}
